package com.gongj.aop.annon;

import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@ComponentScan(basePackages = {"com.gongj.aop"})
@EnableAspectJAutoProxy
public class AppConfig {


	//@Bean
	public BeanNameAutoProxyCreator creator() {
		BeanNameAutoProxyCreator beanNameAutoProxyCreator = new BeanNameAutoProxyCreator();
		//可以传入多个
		beanNameAutoProxyCreator.setBeanNames("gongService");
		//可以传入多个
		beanNameAutoProxyCreator.setInterceptorNames("myCustomizeAdvisor");
		return beanNameAutoProxyCreator;
	}
	//@Bean
	public DefaultAdvisorAutoProxyCreator proxyCreator(){
		DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
		return proxyCreator;
	}
}